window.onload = function(){
	var height = $(window).height();
	$('body').height(height);
	var height2 = $('.scrollCont').offset().top;
	var height3 = $('.date-footer').height();
	$('.scrollCont').height(height - height2 - height3);
	var myScroll = new IScroll('#wrapper', {
	    mouseWheel: true,
	    scrollbars: false
	});
	console.log(myScroll);
}
$(function(){
	
	$('.chakan').on('tap',function(){
		$('.chakan').removeClass('active');
		$(this).addClass('active');
		var index = $(this).index();
		$('.mui-content').removeClass('show');
		$($('.mui-content')[index]).addClass('show');
	})
	$('.dep').on('tap',function(){
		$.post('/index/api/departmenList',{},function (data) {
			console.log(data);
			if(data.code==200){
				var $str = '<div class="depList">';
				$.each(data.date,function (i,v) {
                    $str+= '<button class="mui-btn depBtn mui-pull-left" data="'+v.id+'">'+v.departmen_name+'</button>';
                });
                    $str+='</div>';
                setTimeout(function(){
                    var index2 = layer.open({
                        title: [
                            '选择部门',
                            'background-color: #4990E2; color:#fff;'
                        ]
                        ,content: $str
                    });
                    $('.depBtn').on('tap',function(){
                        var text =$(this).attr('data');
                        var $dYear = $('.zuo').attr('dataY');
                        var $dMonth = $(".zuo").attr('dataM');
                        var $dDay = $(".zuo").attr('dataD');
                        var $mYear = $(".zuoyue").attr('dataY');
                        var $mMonth = $(".zuoyue").attr('dataM');
                        var $types  = $("#ninxing").val();
                        window.location.href = '/index/index/attenstatic?department_id='+text+'&dYear='+$dYear+'&dMonth='+$dMonth+'&dDay='+$dDay
						+'&mYear='+$mYear+'&mMonth'+$mMonth+'&types='+$types;
                        $('.choiceDep').val(text);
                        layer.close(index2);
                    })
                },100);
			}else{
				mui.alert(data.msg);
			}
        });
	});
});
 